import request from '../utils/request'

export const login = data => request({
    url: '/v1_0/authorizations',
    method: 'POST',
    data
})

export const sendVerificationCode = mobile => request({
    url: `/v1_0/sms/codes/${mobile}`,
})

export const getUserInfo = () => request({
    url: '/v1_0/user',
    // headers: {
    //     Authorization: `Bearer ${store.state.user.token}`
    // }
})

export const getUserChannels = () => request({
    url: '/v1_0/user/channels',
})

export const addFollow = target => request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
        target
    }
})

export const deleteFollow = target => request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${target}`,
})

export const getUserProfile = () => request({
    url: '/v1_0/user/profile',
})

export const updateUserProfile = data => request({
    method: 'PATCH',
    url: '/v1_0/user/profile',
    data
})

export const updateUserPhoto = data => request({
    method: 'PATCH',
    url: '/v1_0/user/photo',
    data
})
